package com.you.atlas.web.member.module.screen;

import java.io.IOException;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.china.fasttext.json.JSONObject;
import com.alibaba.citrus.turbine.TurbineRunData;
import com.alibaba.citrus.turbine.dataresolver.Param;
import com.you.common.webx.AuthContext;
import com.you.member.biz.service.FeedService;

public class BroadcastDelete {

    @Autowired
    private FeedService feedService;

    public void execute(@Param("id") Long id, TurbineRunData rundata) throws IOException {

        JSONObject json = new JSONObject();
        boolean result = false;

        if (!AuthContext.getContext().isLogin()) {
            json.put("result", result);
            json.put("error", "needLogin");
            rundata.getResponse().getWriter().write(json.toString());
            return;
        }

        result = feedService.delete(id, AuthContext.getContext().getMemberId());
        json.put("result", result);
        json.put("id", id);
        rundata.getResponse().getWriter().write(json.toString());

    }
}
